package com.simple.common.framework;

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

import java.time.Clock;
import java.time.ZoneId;

/**
 * @author yasud
 * @date 2020年11月03日 15:07
 * @description
 */
@Configuration
public class CommonConfiguration {

    /**
     * 时钟
     * @return
     */
    @Bean
    public Clock clock() {
        Clock system = Clock.system(ZoneId.of("Asia/Shanghai"));
        return system;
    }


    @Bean
    @ConditionalOnMissingBean
    @LoadBalanced
    public RestTemplate restTemplate() {
        RestTemplate restTemplate = new RestTemplate();
        return restTemplate;
    }
}
